package top.kaoshanji.p2ch09a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 代码清单-p2ch09a-296页b：不同版本的接口实现对象的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/2/2 11:19
 */
public class ServiceConsumer {

    private static final Logger logger = LogManager.getLogger(ServiceConsumer.class);

    public static void main(String[] args) throws Exception {

        logger.info("...代码清单-p2ch09a-296页b：不同版本的接口实现对象的使用示例...");

        String serviceName = "top.kaoshanji.p2ch09a.SampleService";

        Versionized v1 = ServiceFactory.getService(serviceName, "v1");
        Versionized v2 = ServiceFactory.getService(serviceName, "v2");

        System.out.println(v1.getVersion());
        System.out.println(v2.getVersion());

    }

}
